package com.example.demo.service.impl;

import com.example.demo.config.annotation.TimeOutAnnotation;
import com.example.demo.result.BaseResult;
import com.example.demo.service.TimeOutTestService;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * @Author: njz
 * @Description:
 * @Date: create in 2022/7/4 17:26
 */
@Service
public class TimeOutTestServiceImpl implements TimeOutTestService {

    @Override
    @TimeOutAnnotation
    public BaseResult test1() throws InterruptedException {
        TimeUnit.SECONDS.sleep(6);
        return BaseResult.result(200,"6s");
    }

    @Override
    @TimeOutAnnotation
    public BaseResult test2() throws InterruptedException {
        TimeUnit.SECONDS.sleep(4);
        return BaseResult.result(200,"4s");
    }
}
